package cn.tiancaifan.entity;

public class SystemResult {
    private int code;
    private String msg;
    private Object data;

    public static SystemResult ok(String msg,Object data){
        SystemResult result = new SystemResult();
        result.setCode(200);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static SystemResult error(String msg){
        SystemResult result = new SystemResult();
        result.setCode(500);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "SystemResult{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
